package cn.ctyt.midway.base.client;

import org.apache.ignite.Ignite;
import org.apache.ignite.Ignition;

import cn.ctyt.midway.base.IMidwayDaoService;
import cn.ctyt.midway.base.IMidwayService;

public class IgniteClient {

	private static IgniteClient client = new IgniteClient();
	
	private Ignite ignite;
	
	public static IgniteClient getClient() {
		return client;
	}
	
	public IMidwayService getService(Class<? extends IMidwayDaoService<?>> type, String id) {
		return ignite.services().serviceProxy(id, type, false);
	}
	
	public void start() {
		Ignition.setClientMode(true);
		ignite = Ignition.start();
	}
}